import request from '@/config/axios'

// 规则字典 VO
export interface RuleDictVO {
  id: number // 规则ID
  ruleType: number // 规则类型
  ruleCode: string // 规则编码
  ruleName: string // 规则名称
  ruleValue: string // 规则值
  ruleDesc: string // 规则描述
  sortOrder: number // 排序号
  isEnabled: number // 是否启用
}

// 规则字典 API
export const RuleDictApi = {
  // 查询规则字典分页
  getRuleDictPage: async (params: any) => {
    return await request.get({ url: `/ride/rule-dict/page`, params })
  },

  // 查询规则字典详情
  getRuleDict: async (id: number) => {
    return await request.get({ url: `/ride/rule-dict/get?id=` + id })
  },

  // 新增规则字典
  createRuleDict: async (data: RuleDictVO) => {
    return await request.post({ url: `/ride/rule-dict/create`, data })
  },

  // 修改规则字典
  updateRuleDict: async (data: RuleDictVO) => {
    return await request.put({ url: `/ride/rule-dict/update`, data })
  },

  // 删除规则字典
  deleteRuleDict: async (id: number) => {
    return await request.delete({ url: `/ride/rule-dict/delete?id=` + id })
  },

  // 导出规则字典 Excel
  exportRuleDict: async (params) => {
    return await request.download({ url: `/ride/rule-dict/export-excel`, params })
  },
}